

//普通方式验证用户名是否已被注册
var xmlHttp
function ajaxEmailCheck() {

var email = document.getElementById("email").value;

xmlHttp = GetXmlHttpObject();

var url = "servlet/AjaxCheckServlet?email=" + email + "";
xmlHttp.onreadystatechange = stateChanged;
xmlHttp.open("POST", url, true);
xmlHttp.send(null);
}

function stateChanged() {
if (xmlHttp.readyState == 3) {
document.getElementById("emailSpan").innerHTML = "zhengzaichaxun";
}

if (xmlHttp.readyState == 4) {
document.getElementById("emailSpan").innerHTML = xmlHttp.responseText;
}
}

function GetXmlHttpObject() {
var xmlHttp = null;
try {
// IE7+、Firefox、Chrome、Safari、 Opera
xmlHttp = new XMLHttpRequest();
} catch (e) {
//IE6、IE5
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlHttp;
} 
